package org.esgl3d.scene;

import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.esgl3d.rendering.RenderQueue;
import org.esgl3d.rendering.Renderer;
import org.esgl3d.rendering.Renderer.MatrixType;
import org.esgl3d.rendering.VertexContainer.PrimitiveType;
import org.esgl3d.spatial.NoneSpatialStructure;
import org.esgl3d.spatial.SpatialStructure;
import org.esgl3d.util.HighPerformanceCounter;

public class Scene {
	private static final Logger logger = Logger.getLogger(Scene.class.getName());
	
	private ArrayList<SceneNode> childNodes = new ArrayList<SceneNode>();
	private ArrayList<LightNode> lightNodes = new ArrayList<LightNode>();
	private SpatialStructure spatialSeperator = null;
	
	public SpatialStructure getSpatialStructure() {
		return spatialSeperator;
	}
	
	public Scene() {
		spatialSeperator = new NoneSpatialStructure(this);
	}
	
	public void addChild(SceneNode node) {
		childNodes.add(node);
		
		node.setOwningSceneRecursively(this);
	}
	
	public void removeChild(SceneNode node) {
		childNodes.remove(node);
		
		node.setOwningSceneRecursively(null);
	}

	public ArrayList<SceneNode> getChildren() {
		return childNodes;
	}
	
	public void registerLightNode(LightNode node) {
		if (!lightNodes.contains(node))
			lightNodes.add(node);
	}
	
	public void unregisterLightNode(LightNode node) {
		if (lightNodes.contains(node))
			lightNodes.remove(node);
	}
}
